package com.oracle.application.config;



import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MQConfig {


    @Bean       //队列名称
    public Queue logCreateQueue(){

        return new Queue("logCreateQueue",false,false,false);
    }

    @Bean     //交换机名称
    public DirectExchange  logDirectExchange(){
        return new DirectExchange("logDirectExchange");
    }

    @Bean    //队列和交换机绑定
    public Binding logCreateQueueAndlogDirectExchange(){
        return BindingBuilder.bind(logCreateQueue()).to(logDirectExchange()).with("log.create");
    }

}
